package com.asyf.provider.common.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @Author yjz
 * @Date 2021/7/6 10:37
 */
@Slf4j
public class DynamicRoutingDataSource extends AbstractRoutingDataSource {
    protected Object determineCurrentLookupKey() {
        log.info("当前数据源 [{}]", DynamicDataSourceContextHolder.getDataSourceKey());
        return DynamicDataSourceContextHolder.getDataSourceKey();
    }
}
